package com.lnsf.dao;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import com.lnsf.entity.Category;

public interface CategoryDao extends CrudRepository<Category,Integer> {
	

	/**
	 * CategoryDao
	 * 实现商品分类的增删改查
	 * @author 小曾
	 * 2017-7-26
	 */ 	
	
   @Override
   public Iterable<Category> findAll();
   
   @Override
   public Category findOne(Integer arg0);
   
   @Override
   public <S extends Category> S save(S arg0);
   
   @Override
	public void delete(Integer arg0);
   
   @Modifying
   @Query(value="update category set name= ?2 where id = ?1",nativeQuery=true)
   public int updateCategory(int id,String name);

}
